let v = new Vue({
    el:'#main-container',
    data:{
        area:{

        }
    },
    methods:{
        toIcon:function () {
            layer.open({
                type: 2,
                title: '选择图标',
                area: ['80%', '80%'],
                content: 'manager/area/toIcon',
                end:() => {
                    // if(!layer.success){
                    //     this.findAll(1,this.pageInfo.pageSize);
                    // }
                    if(layer.icon != null){
                        this.area.icon = layer.icon;
                        console.log(this.area);
                    }
                }
            })
        },
        toSelect:function () {

            layer.open({
                type: 2,
                title: '选择父区域',
                area: ['80%', '80%'],
                content: 'manager/area/toSelect',
                end:() => {
                    // if(!layer.success){
                    //     this.findAll(1,this.pageInfo.pageSize);
                    // }
                    // if(layer.icon != null){
                    //     this.area.icon = layer.icon;
                    //     console.log(this.area);
                    // }
                    if(layer.tNode != undefined && layer.tNode.id != this.area.parentId){
                        this.area.parentName = layer.tNode.name;
                        this.area.parentIds = layer.tNode.parentIds + layer.tNode.id + ',';
                        this.area.parentId = layer.tNode.id;
                    }
                }
            })
        },
        doUpdate:function () {
            axios({
                url:'manager/area/doUpdate',
                method:'put',
                data:this.area
            }).then(resp => {
                let index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
                parent.layer.msg(resp.data.msg);
            }).catch(error => {
                layer.msg(error.message());
                this.area.oldParentIds = '';
            })
        }
    },
    created:function () {
        this.area = parent.layer.obj;
        this.area.oldParentIds = this.area.parentIds;
    }
})